GBML manual / Text

draw_text_3d_anchored

draw_text_3d, but the position is measured from a spot on the screen (ANCHOR_TOP_CENTER, ANCHOR_BOTTOM_RIGHT, ...) instead of from the top-left corner, and it is fixed to the screen wherever you call it - a banner that curves away from you and stays at the top of the screen on any screen. shape and depth work exactly as they do in draw_text_3d: depth goes up to 6, and TEXT_DRUM slides the word through a lens fixed on the middle of the screen.

Works differently on Game Boy - The Game Boy cannot squeeze letters row by row: a short 3D text gets a copy behind it, TEXT_BULGE arches the line, TEXT_DRUM and TEXT_BAND show it only inside their lens (24 letters at most, drawn with sprites).

Works differently on Game Boy Color - The Game Boy Color cannot squeeze letters row by row: a short 3D text gets a copy behind it, TEXT_BULGE arches the line, TEXT_DRUM and TEXT_BAND show it only inside their lens (24 letters at most, drawn with sprites).

Sega Genesis: not available

On other consoles this differs: see Side by side and How the consoles differ.

Syntax

draw_text_3d_anchored(anchor, x, y, text, shape, depth)

Arguments

NameType
anchoranchor
xreal
yreal
textstring
shapetext_shape
depthint

Returns

Nothing.

Description

draw_text_3d, with the position measured from a named spot on the screen (an anchor) instead of from the top-left corner. It is for a title or a banner that curves away from you and should stay in a corner or on an edge whatever the screen size. The anchored call is fixed to the screen wherever you write it (a Step event, a script, any event), not only in a Draw GUI event.

A real capture - the words LEVEL 3, with every letter pinched to a point at its top and bottom like a barrel, centered along the top of an otherwise empty screenA real capture - the words LEVEL 3, with every letter pinched to a point at its top and bottom like a barrel, centered along the top of an otherwise empty screen
A real capture - the words LEVEL 3, with every letter pinched to a point at its top and bottom like a barrel, centered along the top of an otherwise empty screen

The whole screen, as the console drew it. The banner hangs from the top-centre anchor.

After the anchor and the offset, the arguments are exactly draw_text_3d's own: the text, then the shape (TEXT_BULGE, TEXT_LEAN_BACK, TEXT_LEAN_FORWARD or TEXT_DRUM) and the depth from 0 to 6. It costs what draw_text_3d costs, out of the same pool: one matrix and two of the eight row-by-row effects.

Example

text_align(ALIGN_CENTER);
draw_text_3d_anchored(ANCHOR_TOP_CENTER, 0, 24, "LEVEL 3", TEXT_BULGE, 5);

The words LEVEL 3, pinched at the top and bottom of every letter like a barrel seen close up, centered along the top of the screen and 24 pixels down from its edge (depth 5 needs a bold 32 pixel font).

On the GBA

Exactly draw_text_3d in a Draw GUI event once the anchor is added to (x, y): one affine matrix and two of the eight row-by-row effects (the GBA keeps two of the eight for a room transition), none at all for depth 0, the same front-most layer, and a clear stop with a message if there is no room. Depths 4 to 6 need a font drawn from sprites 32 pixels tall (a smaller font is drawn at depth 3 and a development build says so in the log) and are worked out in memory the first time, so they take no cartridge space. The anchors sit where the screen’s own pixels say on the 240x160 screen - ANCHOR_TOP_CENTER is (120, 0).

See also: Screen anchorsdraw_text_3ddraw_text_anchoredtext_align